<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="../templates/ui.xhtml">

	<ui:define name="content">


		<h1 class="title ui-widget-header ui-corner-all">AJAX - Ajaxify</h1>
		<div class="entry">
			<p>p:ajax enables ajax behavior on any JSF component.</p>

			<h:form id="form">
			
				<p:panel header="Ajaxify">
					<h:panelGrid columns="3" cellpadding="5">
						<h:outputText value="KeyUp: " />
						<p:inputText id="firstname" value="#{pprBean.firstname}">
							<p:ajax event="keyup" update="out1" />
						</p:inputText>
						<h:outputText id="out1" value="#{pprBean.firstname}" />
						
						<h:outputText value="Blur: " />
						<p:inputText id="surname" value="#{pprBean.surname}">
							<p:ajax event="blur" update="out2" />
						</p:inputText>
						<h:outputText id="out2" value="#{pprBean.surname}" />
					</h:panelGrid>
				</p:panel>
				
			</h:form>
					
			<h3>Source</h3>
			<p:tabView>
				<p:tab title="ajaxifyKeyEvents.xhtml">
					<pre name="code" class="xml">
&lt;h:form id="form"&gt;
			
	&lt;p:panel header="Ajaxify"&gt;
		&lt;h:panelGrid columns="3" cellpadding="5"&gt;
			&lt;h:outputText value="KeyUp: " /&gt;
			&lt;p:inputText id="firstname" value="\#{pprBean.firstname}"&gt;
				&lt;p:ajax event="keyup" update="out1" /&gt;
			&lt;/p:inputText&gt;
			&lt;h:outputText id="out1" value="\#{pprBean.firstname}" /&gt;
			
			&lt;h:outputText value="Blur: " /&gt;
			&lt;p:inputText id="surname" value="\#{pprBean.surname}"&gt;
				&lt;p:ajax event="blur" update="out2" /&gt;
			&lt;/p:inputText&gt;
			&lt;h:outputText id="out2" value="\#{pprBean.surname}" /&gt;
		&lt;/h:panelGrid&gt;
	&lt;/p:panel&gt;
				
&lt;/h:form&gt;
					</pre>
				</p:tab>
				
				<p:tab title="PersonBean.java">
				<pre name="code" class="java">
package org.primefaces.examples.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class PersonBean {

	private String firstname;
	
	private String surname;

	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}
	
	public void savePerson(ActionEvent actionEvent) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Welcome " + firstname + " " + surname + "!"));
	}
}
</pre>
					</p:tab>
			</p:tabView>
				
					</div>
				
	</ui:define>
</ui:composition>